home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 August / macformat-027.iso / mac / Shareware City / Developers / Oberon⁄F / Form / Mod / Models (.txt) < prev    next >
Encoding:
Oberon Document  |  1994-06-07  |  18.1 KB  |  537 lines  |  [oODC/obnF]

  1. Documents.StdDocumentDesc
  2. Documents.DocumentDesc
  3. Containers.ViewDesc
  4. Views.ViewDesc
  5. Stores.StoreDesc
  6. Documents.ModelDesc
  7. Containers.ModelDesc
  8. Models.ModelDesc
  9. Stores.ElemDesc
  10. TextViews.StdViewDesc
  11. TextViews.ViewDesc
  12. TextModels.StdModelDesc
  13. TextModels.ModelDesc
  14. TextModels.AttributesDesc
  15. Geneva
  16. Geneva
  17. StdStamps.StdViewDesc
  18. Geneva
  19. MODULE FormModels;
  20. (** OmInc 
  21.     IMPORT Domains, Ports, Stores, Models, Views, Properties, Containers;
  22.     CONST
  23.         minViewSize* = 4 * Ports.point;    (** size of smallest embedded view **)
  24.         maxViewSize* = 160 * Ports.mm;    (** size of largest embedded view **)
  25.         (* range of currently supported versions *)
  26.         minVersion = 0; maxBaseVersion = 0; maxStdVersion = 0;
  27.     TYPE
  28.         (* interface types *)
  29.         Model* = POINTER TO ModelDesc;
  30.         ModelDesc* = RECORD (Containers.ModelDesc) END;
  31.         Directory* = POINTER TO DirectoryDesc;
  32.         DirectoryDesc* = RECORD END;
  33.         Context* = POINTER TO ContextDesc;
  34.         ContextDesc* = RECORD (Models.ContextDesc) END;
  35.         Reader* = POINTER TO ReaderDesc;
  36.         ReaderDesc* = RECORD
  37.             view*: Views.View;    (** most recently read view **)
  38.             l*, t*, r*, b*: LONGINT    (** bounding box of most recently read view **)
  39.         END;
  40.         Writer* = POINTER TO WriterDesc;
  41.         WriterDesc* = RECORD END;
  42.         UpdateMsg* = RECORD (Models.UpdateMsg)
  43.             (** the receiver of this message must not switch on any marks **)
  44.             l*, t*, r*, b*: LONGINT    (** (l < r) & (b < t) **)
  45.         END;
  46.         (* concrete types *)
  47.         StdModel = POINTER TO StdModelDesc;
  48.         StdContext = POINTER TO StdContextDesc;
  49.         StdModelDesc = RECORD (ModelDesc)
  50.             contexts: StdContext    (* list of views in form, ordered from bottom to top *)
  51.         END;
  52.         StdDirectory = POINTER TO StdDirectoryDesc;
  53.         StdDirectoryDesc = RECORD (DirectoryDesc) END;
  54.         StdContextDesc = RECORD (ContextDesc)
  55.             next: StdContext;    (* next upper view *)
  56.             form: StdModel;    (* form # NIL *)
  57.             view: Views.View;    (* view # NIL *)
  58.             l, t, r, b: LONGINT    (* (r - l >= minViewSize) & (b - t >= minViewSize) *)
  59.         END;
  60.         StdReader = POINTER TO StdReaderDesc;
  61.         StdReaderDesc = RECORD (ReaderDesc)
  62.             form: StdModel;    (* form # NIL *)
  63.             pos: StdContext    (* next ReadView: read view above pos *)
  64.         END;
  65.         StdWriter = POINTER TO StdWriterDesc;
  66.         StdWriterDesc = RECORD (WriterDesc)
  67.             form: StdModel;    (* form # NIL *)
  68.             pos: StdContext    (* next WriteView: insert view above pos *)
  69.         END;
  70.         FormOp = POINTER TO FormOpDesc;
  71.         FormOpDesc = RECORD (Domains.OperationDesc)
  72.             del, ins: StdContext;    (* ((del = NIL) # (ins = NIL)) OR (del = ins) *)
  73.             pos: StdContext    (* ins # NIL => next Do: insert ins above pos *)
  74.         END;
  75.         ResizeOp = POINTER TO ResizeOpDesc;
  76.         ResizeOpDesc = RECORD (Domains.OperationDesc)
  77.             context: StdContext;    (* context # NIL *)
  78.             l, t, r, b: LONGINT    (* (r - l >= minViewSize) & (b - t >= minViewSize) *)
  79.         END;
  80.         ReplaceViewOp = POINTER TO ReplaceViewDesc;
  81.         ReplaceViewDesc = RECORD (Domains.OperationDesc)
  82.             context: StdContext;    (* context # NIL *)
  83.             view: Views.View    (* view # NIL *)
  84.         END;
  85.     VAR dir-, stdDir-: Directory;    (** (dir # NIL) & (stdDir # NIL) **)
  86.     (** Model **)
  87.     PROCEDURE (f: Model) Clone* (): Model;
  88.     (** function result is narrowed **)
  89.         VAR s: Stores.Store;
  90.     BEGIN
  91.         s := Stores.Clone(f); RETURN s(Model)
  92.     END Clone;
  93.     PROCEDURE (f: Model) Internalize* (VAR rd: Stores.Reader);
  94.         VAR thisVersion: SHORTINT;
  95.     BEGIN
  96.         ASSERT(~f.init, 20);
  97.         f.Internalize^(rd);
  98.         IF rd.cancelled THEN RETURN END;
  99.         rd.ReadVersion(minVersion, maxBaseVersion, thisVersion)
  100.     END Internalize;
  101.     PROCEDURE (f: Model) Externalize* (VAR wr: Stores.Writer);
  102.     BEGIN
  103.         ASSERT(f.init, 20);
  104.         f.Externalize^(wr);
  105.         wr.WriteVersion(maxBaseVersion)
  106.     END Externalize;
  107.     PROCEDURE (f: Model) GetEmbeddingLimits* (VAR minW, maxW, minH, maxH: LONGINT);
  108.     BEGIN
  109.         minH := minViewSize; minW := minViewSize;
  110.         maxH := maxViewSize; maxW := maxViewSize
  111.     END GetEmbeddingLimits;
  112.     PROCEDURE (f: Model) Insert* (v: Views.View; l, t, r, b: LONGINT);
  113.         v # NIL    20
  114.         v.init    21
  115.         v.context = NIL    22
  116.         l <= r    23
  117.         t <= b    24
  118.     BEGIN
  119.         HALT(127)
  120.     END Insert;
  121.     PROCEDURE (f: Model) Delete* (v: Views.View);
  122.     (** v in f    20 **)
  123.     BEGIN
  124.         HALT(127)
  125.     END Delete;
  126.     PROCEDURE (f: Model) Resize* (v: Views.View; l, t, r, b: LONGINT);
  127.         v in f    20
  128.         l <= r    21
  129.         t <= b    22
  130.     BEGIN
  131.         HALT(127)
  132.     END Resize;
  133.     PROCEDURE (f: Model) PutAbove* (v, pos: Views.View);
  134.         v in f    20
  135.         (pos = NIL) OR (pos in f)    21
  136.     BEGIN
  137.         HALT(127)
  138.     END PutAbove;
  139.     PROCEDURE (f: Model) Move* (v: Views.View; dx, dy: LONGINT);
  140.     (** v in f    20 **)
  141.     BEGIN
  142.         HALT(127)
  143.     END Move;
  144.     PROCEDURE (f: Model) Copy* (VAR v: Views.View; dx, dy: LONGINT);
  145.     (** v in f    20 **)
  146.     BEGIN
  147.         HALT(127)
  148.     END Copy;
  149.     PROCEDURE (f: Model) NewReader* (old: Reader): Reader;
  150.     BEGIN
  151.         HALT(127)
  152.     END NewReader;
  153.     PROCEDURE (f: Model) NewWriter* (old: Writer): Writer;
  154.     BEGIN
  155.         HALT(127)
  156.     END NewWriter;
  157.     PROCEDURE (f: Model) ViewAt* (x, y: LONGINT): Views.View;
  158.     BEGIN
  159.         HALT(127)
  160.     END ViewAt;
  161.     PROCEDURE (f: Model) NofViews* (): INTEGER;
  162.     BEGIN
  163.         HALT(127)
  164.     END NofViews;
  165.     (** Directory **)
  166.     PROCEDURE (d: Directory) New* (): Model;
  167.     BEGIN
  168.         HALT(127)
  169.     END New;
  170.     (** Context **)
  171.     PROCEDURE (c: Context) ThisModel* (): Model;
  172.     BEGIN
  173.         RETURN NIL
  174.     END ThisModel;
  175.     PROCEDURE (c: Context) GetRect* (VAR l, t, r, b: LONGINT);
  176.     BEGIN
  177.         HALT(127)
  178.     END GetRect;
  179.     (** Reader **)
  180.     PROCEDURE (r: Reader) Set* (pos: Views.View);
  181.     (** (pos = NIL) OR (pos in r's form)    20 **)
  182.     BEGIN
  183.         HALT(127)
  184.     END Set;
  185.     PROCEDURE (r: Reader) ReadView* (VAR v: Views.View);
  186.     BEGIN
  187.         HALT(127)
  188.     END ReadView;
  189.     (** Writer **)
  190.     PROCEDURE (w: Writer) Set* (pos: Views.View);
  191.     (** (pos = NIL) OR (pos in w's form)    20 **)
  192.     BEGIN
  193.         HALT(127)
  194.     END Set;
  195.     PROCEDURE (w: Writer) WriteView* (v: Views.View; l, t, r, b: LONGINT);
  196.         v # NIL    20
  197.         v.init    21
  198.         v.context = NIL    22
  199.         l <= r    23
  200.         t <= b    24
  201.     BEGIN
  202.         HALT(127)
  203.     END WriteView;
  204.     (* StdModel *)
  205.     PROCEDURE Temporary (v: Views.View): BOOLEAN;
  206.         VAR p: Properties.StorePref;
  207.     BEGIN
  208.         p.temporary := FALSE; v.HandlePropMsg(p);
  209.         RETURN p.temporary
  210.     END Temporary;
  211.     PROCEDURE ThisContext (f: StdModel; view: Views.View): StdContext;
  212.         VAR c: StdContext;
  213.     BEGIN
  214.         c := f.contexts; WHILE (c # NIL) & (c.view # view) DO c := c.next END;
  215.         RETURN c
  216.     END ThisContext;
  217.     PROCEDURE NewContext (form: StdModel; view: Views.View; l, t, r, b: LONGINT): StdContext;
  218.         VAR c: StdContext;
  219.     BEGIN
  220.         ASSERT(form # NIL, 20);
  221.         IF r - l < minViewSize THEN r := l + minViewSize END;
  222.         IF b - t < minViewSize THEN b := t + minViewSize END;
  223.         NEW(c); c.form := form; c.view := view; c.l := l; c.t := t; c.r := r; c.b := b;
  224.         view.InitContext(c);
  225.         RETURN c
  226.     END NewContext;
  227.     PROCEDURE InsertAbove (c, pos: StdContext);
  228.     BEGIN
  229.         IF pos = NIL THEN
  230.             c.next := NIL; c.form.contexts := c
  231.         ELSE
  232.             c.next := pos.next; pos.next := c
  233.         END
  234.     END InsertAbove;
  235.     PROCEDURE (f: StdModel) Internalize (VAR rd: Stores.Reader);
  236.         VAR thisVersion: SHORTINT; top, h: StdContext; v: Views.View; l, t, r, b: LONGINT;
  237.     BEGIN
  238.         f.Internalize^(rd);
  239.         IF rd.cancelled THEN RETURN END;
  240.         rd.ReadVersion(minVersion, maxStdVersion, thisVersion);
  241.         IF rd.cancelled THEN RETURN END;
  242.         Views.ReadView(rd, v); top := NIL;
  243.         WHILE v # NIL DO
  244.             rd.ReadLInt(l); rd.ReadLInt(t); rd.ReadLInt(r); rd.ReadLInt(b);
  245.             h := NewContext(f, v, l, t, r, b);
  246.             InsertAbove(h, top); top := h;
  247.             Views.ReadView(rd, v)
  248.         END
  249.     END Internalize;
  250.     PROCEDURE (f: StdModel) Externalize (VAR wr: Stores.Writer);
  251.         VAR c: StdContext;
  252.     BEGIN
  253.         f.Externalize^(wr);
  254.         wr.WriteVersion(maxStdVersion);
  255.         c := f.contexts;
  256.         WHILE c # NIL DO
  257.             IF ~Temporary(c.view) THEN
  258.                 Views.WriteView(wr, c.view);
  259.                 wr.WriteLInt(c.l); wr.WriteLInt(c.t); wr.WriteLInt(c.r); wr.WriteLInt(c.b)
  260.             END;
  261.             c := c.next
  262.         END;
  263.         wr.WriteStore(NIL)
  264.     END Externalize;
  265.     PROCEDURE (f: StdModel) InitDomain (d: Domains.Domain);
  266.         VAR c: StdContext;
  267.     BEGIN
  268.         f.InitDomain^(d);
  269.         c := f.contexts; WHILE c # NIL DO c.view.InitDomain(d); c := c.next END
  270.     END InitDomain;
  271.     PROCEDURE (f: StdModel) CopyAllFrom (source: Containers.Model);
  272.         VAR c, top, h: StdContext;
  273.     BEGIN
  274.         f.CopyAllFrom^(source);
  275.         WITH source: StdModel DO
  276.             c := source.contexts; top := NIL;
  277.             WHILE c # NIL DO
  278.                 h := NewContext(f, Views.CopyOf(c.view, Views.deep), c.l, c.t, c.r, c.b);
  279.                 InsertAbove(h, top); top := h;
  280.                 c := c.next
  281.             END
  282.         END
  283.     END CopyAllFrom;
  284.     PROCEDURE (f: StdModel) ReplaceView (old, new: Views.View);
  285.         VAR op: ReplaceViewOp; c: StdContext;
  286.     BEGIN
  287.         c := ThisContext(f, old); ASSERT(c # NIL, 20);
  288.         ASSERT(new # NIL, 21); ASSERT(new.init, 22); ASSERT(new.context = NIL, 23);
  289.         NEW(op); op.context := c; op.view := new;
  290.         Models.Do(f, "#System:ReplaceView", op)
  291.     END ReplaceView;
  292.     PROCEDURE (f: StdModel) Insert (v: Views.View; l, t, r, b: LONGINT);
  293.         VAR op: FormOp; c, h, top: StdContext;
  294.     BEGIN
  295.         ASSERT(v # NIL, 20); ASSERT(v.init, 21); ASSERT(v.context = NIL, 22);
  296.         ASSERT(l <= r, 23); ASSERT(t <= b, 24);
  297.         h := f.contexts; top := NIL; WHILE h # NIL DO top := h; h := h.next END;
  298.         c := NewContext(f, v, l, t, r, b);
  299.         NEW(op); op.del := NIL; op.ins := c; op.pos := top;
  300.         Models.Do(f, "#System:Insertion", op)
  301.     END Insert;
  302.     PROCEDURE (f: StdModel) Delete (v: Views.View);
  303.         VAR op: FormOp; c: StdContext;
  304.     BEGIN
  305.         c := ThisContext(f, v); ASSERT(c # NIL, 20);
  306.         NEW(op); op.del := c; op.ins := NIL; op.pos := NIL;
  307.         Models.Do(f, "#System:Deletion", op)
  308.     END Delete;
  309.     PROCEDURE (f: StdModel) Resize (v: Views.View; l, t, r, b: LONGINT);
  310.         VAR op: ResizeOp; c: StdContext;
  311.     BEGIN
  312.         c := ThisContext(f, v); ASSERT(c # NIL, 20);
  313.         ASSERT(r >= l, 21); ASSERT(b >= t, 22);
  314.         IF r - l < minViewSize THEN r := l + minViewSize END;
  315.         IF b - t < minViewSize THEN b := t + minViewSize END;
  316.         NEW(op); op.context := c; op.l := l; op.t := t; op.r := r; op.b := b;
  317.         Models.Do(f, "#System:Resizing", op)
  318.     END Resize;
  319.     PROCEDURE (f: StdModel) PutAbove (v, pos: Views.View);
  320.         VAR op: FormOp; c, d: StdContext;
  321.     BEGIN
  322.         c := ThisContext(f, v); ASSERT(c # NIL, 20);
  323.         d := ThisContext(f, pos); ASSERT((pos = NIL) OR (d # NIL), 21);
  324.         NEW(op); op.del := c; op.ins := c; op.pos := d;
  325.         Models.Do(f, "#Form:ChangeZOrder", op)
  326.     END PutAbove;
  327.     PROCEDURE (f: StdModel) Move (v: Views.View; dx, dy: LONGINT);
  328.         VAR op: ResizeOp; c: StdContext;
  329.     BEGIN
  330.         c := ThisContext(f, v); ASSERT(c # NIL, 20);
  331.         NEW(op); op.context := c;
  332.         op.l := c.l + dx; op.t := c.t + dy; op.r := c.r + dx; op.b := c.b + dy;
  333.         Models.Do(f, "#System:Moving", op)
  334.     END Move;
  335.     PROCEDURE (f: StdModel) Copy (VAR v: Views.View; dx, dy: LONGINT);
  336.         VAR op: FormOp; c, h, top: StdContext;
  337.     BEGIN
  338.         c := ThisContext(f, v); ASSERT(c # NIL, 20);
  339.         h := f.contexts; top := NIL; WHILE h # NIL DO top := h; h := h.next END;
  340.         h := NewContext(f, Views.CopyOf(v, Views.deep), c.l + dx, c.t + dy, c.r + dx, c.b + dy);
  341.         NEW(op); op.del := NIL; op.ins := h; op.pos := top;
  342.         Models.Do(f, "#System:Copying", op);
  343.         v := h.view
  344.     END Copy;
  345.     PROCEDURE (f: StdModel) NewReader (old: Reader): Reader;
  346.         VAR r: StdReader;
  347.     BEGIN
  348.         IF (old = NIL) OR ~(old IS StdReader) THEN NEW(r) ELSE r := old(StdReader) END;
  349.         NEW(r); r.view := NIL; r.form := f; r.pos := NIL; RETURN r
  350.     END NewReader;
  351.     PROCEDURE (f: StdModel) NewWriter (old: Writer): Writer;
  352.         VAR w: StdWriter;
  353.     BEGIN
  354.         IF (old = NIL) OR ~(old IS StdWriter) THEN NEW(w) ELSE w := old(StdWriter) END;
  355.         NEW(w); w.form := f; w.pos := NIL; RETURN w
  356.     END NewWriter;
  357.     PROCEDURE (f: StdModel) ViewAt (x, y: LONGINT): Views.View;
  358.         VAR c, top: StdContext;
  359.     BEGIN
  360.         c := f.contexts; top := NIL;
  361.         WHILE c # NIL DO
  362.             IF (x >= c.l) & (y >= c.t) & (x < c.r) & (y < c.b) THEN top := c END;
  363.             c := c.next
  364.         END;
  365.         IF top = NIL THEN RETURN NIL ELSE RETURN top.view END
  366.     END ViewAt;
  367.     PROCEDURE (f: StdModel) NofViews (): INTEGER;
  368.         VAR c: StdContext; n: INTEGER;
  369.     BEGIN
  370.         n := 0; c := f.contexts; WHILE c # NIL DO INC(n); c := c.next END;
  371.         RETURN n
  372.     END NofViews;
  373.     (* StdContext *)
  374.     PROCEDURE (c: StdContext) ThisModel (): Model;
  375.     BEGIN
  376.         RETURN c.form
  377.     END ThisModel;
  378.     PROCEDURE (c: StdContext) GetSize (VAR w, h: LONGINT);
  379.     BEGIN
  380.         w := c.r - c.l; h := c.b - c.t
  381.     END GetSize;
  382.     PROCEDURE (c: StdContext) SetSize (w, h: LONGINT);
  383.     BEGIN
  384.         c.form.Resize(c.view, c.l, c.t, c.l + w, c.t + h)
  385.     END SetSize;
  386.     PROCEDURE (c: StdContext) Normalize (): BOOLEAN;
  387.     BEGIN
  388.         RETURN FALSE
  389.     END Normalize;
  390.     PROCEDURE (c: StdContext) GetRect (VAR l, t, r, b: LONGINT);
  391.     BEGIN
  392.         l := c.l; t := c.t; r := c.r; b := c.b
  393.     END GetRect;
  394.     (* StdDirectory *)
  395.     PROCEDURE (d: StdDirectory) New (): Model;
  396.         VAR f: StdModel;
  397.     BEGIN
  398.         NEW(f); f.Init; RETURN f
  399.     END New;
  400.     (* StdReader *)
  401.     PROCEDURE (r: StdReader) Set (pos: Views.View);
  402.         VAR c: StdContext;
  403.     BEGIN
  404.         IF pos = NIL THEN c := NIL ELSE c := ThisContext(r.form, pos); ASSERT(c # NIL, 20) END;
  405.         r.view := NIL; r.l := 0; r.t := 0; r.r := 0; r.b := 0;
  406.         r.pos := c
  407.     END Set;
  408.     PROCEDURE (r: StdReader) ReadView (VAR v: Views.View);
  409.         VAR c: StdContext;
  410.     BEGIN
  411.         c := r.pos;
  412.         IF c = NIL THEN c := r.form.contexts ELSE c := c.next END;
  413.         IF c # NIL THEN
  414.             r.view := c.view; r.l := c.l; r.t := c.t; r.r := c.r; r.b := c.b;
  415.             r.pos := c
  416.         ELSE
  417.             r.view := NIL; r.l := 0; r.t := 0; r.r := 0; r.b := 0
  418.         END;
  419.         v := r.view
  420.     END ReadView;
  421.     (* StdWriter *)
  422.     PROCEDURE (w: StdWriter) Set (pos: Views.View);
  423.         VAR c: StdContext;
  424.     BEGIN
  425.         IF pos = NIL THEN c := NIL ELSE c := ThisContext(w.form, pos); ASSERT(c # NIL, 20) END;
  426.         w.pos := c
  427.     END Set;
  428.     PROCEDURE (w: StdWriter) WriteView (v: Views.View; l, t, r, b: LONGINT);
  429.         VAR c: StdContext;
  430.     BEGIN
  431.         ASSERT(v # NIL, 20); ASSERT(v.init, 21); ASSERT(v.context = NIL, 22);
  432.         ASSERT(l <= r, 23); ASSERT(t <= b, 24);
  433.         c := NewContext(w.form, v, l, t, r, b);
  434.         IF w.pos = NIL THEN
  435.             c.next := w.form.contexts; w.form.contexts := c
  436.         ELSE
  437.             c.next := w.pos.next; w.pos.next := c
  438.         END;
  439.         w.pos := c
  440.     END WriteView;
  441.     (* operations *)
  442.     PROCEDURE (op: FormOp) Do;
  443.         VAR f: StdModel; c, p, pos: StdContext; msg: UpdateMsg;
  444.     BEGIN
  445.         (* delete *)
  446.         pos := NIL;
  447.         c := op.del;
  448.         IF c # NIL THEN
  449.             f := c.form; ASSERT(f # NIL, 100);
  450.             p := f.contexts; ASSERT(p # NIL, 101);
  451.             IF p = c THEN
  452.                 f.contexts := c.next
  453.             ELSE
  454.                 WHILE p.next # c DO p := p.next; ASSERT(p # NIL, 102) END;
  455.                 pos := p; p.next := c.next
  456.             END;
  457.             c.next := NIL;
  458.             msg.l := c.l; msg.t := c.t; msg.r := c.r; msg.b := c.b; Models.Broadcast(f, msg)
  459.         END;
  460.         (* insert *)
  461.         c := op.ins;
  462.         IF c # NIL THEN
  463.             f := c.form; ASSERT(f # NIL, 103);
  464.             p := f.contexts;
  465.             IF op.pos = NIL THEN
  466.                 c.next := f.contexts; f.contexts := c
  467.             ELSE
  468.                 c.next := op.pos.next; op.pos.next := c
  469.             END;
  470.             c.view.InitDomain(f.domain);
  471.             msg.l := c.l; msg.t := c.t; msg.r := c.r; msg.b := c.b;
  472.             Models.Broadcast(f, msg)
  473.         END;
  474.         (* swap ins and del for undo *)
  475.         p := op.del; op.del := op.ins; op.ins := p; op.pos := pos
  476.     END Do;
  477.     PROCEDURE (op: ResizeOp) Do;
  478.         VAR c: StdContext; msg: UpdateMsg; l, t, r, b: LONGINT;
  479.     BEGIN
  480.         c := op.context;
  481.         (* save old state of context *)
  482.         l := c.l; t := c.t; r := c.r; b := c.b;
  483.         msg.l := c.l; msg.t := c.t; msg.r := c.r; msg.b := c.b; Models.Broadcast(c.form, msg);
  484.         (* set new state of context *)
  485.         c.l := op.l; c.t := op.t; c.r := op.r; c.b := op.b;
  486.         msg.l := c.l; msg.t := c.t; msg.r := c.r; msg.b := c.b; Models.Broadcast(c.form, msg);
  487.         (* old state is new undo state *)
  488.         op.l := l; op.t := t; op.r := r; op.b := b
  489.     END Do;
  490.     PROCEDURE (op: ReplaceViewOp) Do;
  491.         VAR c: StdContext; msg: UpdateMsg; view: Views.View;
  492.     BEGIN
  493.         c := op.context;
  494.         (* save old state of context *)
  495.         view := c.view;
  496.         msg.l := c.l; msg.t := c.t; msg.r := c.r; msg.b := c.b; Models.Broadcast(c.form, msg);
  497.         (* set new state of context *)
  498.         c.view := op.view;
  499.         IF c.view.context = NIL THEN c.view.InitContext(c) END;
  500.         msg.l := c.l; msg.t := c.t; msg.r := c.r; msg.b := c.b; Models.Broadcast(c.form, msg);
  501.         (* old state is new undo state *)
  502.         op.view := view
  503.     END Do;
  504.     (** miscellaneous **)
  505.     PROCEDURE GetRect* (v: Views.View; VAR l, t, r, b: LONGINT);
  506.         v # NIL    20
  507.         v.context # NIL    21
  508.         v.context IS Context    22
  509.     BEGIN
  510.         ASSERT(v # NIL, 20); ASSERT(v.context # NIL, 21); ASSERT(v.context IS Context, 22);
  511.         v.context(Context).GetRect(l, t, r, b)
  512.     END GetRect;
  513.     PROCEDURE SetDir* (d: Directory);
  514.     (** d # NIL    20 **)
  515.     BEGIN
  516.         ASSERT(d # NIL, 20); dir := d
  517.     END SetDir;
  518.     PROCEDURE Init;
  519.         VAR d: StdDirectory;
  520.     BEGIN
  521.         NEW(d); dir := d; stdDir := d
  522.     END Init;
  523. BEGIN
  524.     Init
  525. END FormModels.
  526. TextControllers.StdCtrlDesc
  527. TextControllers.ControllerDesc
  528. Containers.ControllerDesc
  529. Controllers.ControllerDesc
  530. TextRulers.StdRulerDesc
  531. TextRulers.RulerDesc
  532. TextRulers.StdStyleDesc
  533. TextRulers.StyleDesc
  534. TextRulers.AttributesDesc
  535. Geneva
  536. Documents.ControllerDesc
  537.